home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / boostrs.arc / COPYBLK.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1980-01-01  |  5.5 KB  |  80 lines

  1. { ------------------------------------------------
  2.   COPYBLK copies one part of the screen to another
  3.   ------------------------------------------------ }
  4.   Procedure COPYBLK ( X1,Y1,X2,Y2,X3,Y3 : Integer);
  5.  
  6. {           Copies block defined by upper left and lower right
  7.             coordinates (X1,Y1),(X2,Y2) to a block beginning
  8.             at upper left coordinates (X3,Y3).                }
  9.  
  10. begin
  11.    Inline ( $1E/                 { push  ds             Save DS!            }
  12.             $BB/$49/$04/         { mov   bx,449h        video byte offset   }
  13.             $31/$C0/             { xor   ax,ax          ax = 0              }
  14.             $8E/$D8/             { mov   ds,ax          video byte seg      }
  15.             $8A/$07/             { mov   al,[bx]        get byte            }
  16.             $3C/$07/             { cmp   al,7           mono?               }
  17.             $75/$06/             { jne   graphx         no                  }
  18.             $BA/$00/$B0/         { mov   dx,0B000h      regen for mono      }
  19.             $EB/$0C/$90/         { jmp   start          go to parm analysis }
  20.             $BA/$DA/$03/
  21.             $EC/
  22.             $24/$08/
  23.             $74/$FB/             { jz    vtrace }
  24.                          { graphx:                                          }
  25.             $BA/$00/$B8/         { mov   dx,0B800h      regen for graphics  }
  26.             $52/         { start:  push  dx                                 }
  27.             $8B/$5E/$0C/         { mov   bx,[bp+12]     Y1                  }
  28.             $4B/                 { dec   bx             Y1 - 1              }
  29.             $8B/$D3/             { mov   dx,bx          Save in dx          }
  30.             $B1/$07/             { mov   cl,7           prepare to shl      }
  31.             $D3/$E2/             { shl   dx,cl          (Y1-1) * 128        }
  32.             $B1/$05/             { mov   cl,5           another shift       }
  33.             $D3/$E3/             { shl   bx,cl          (Y1-1) * 32         }
  34.             $01/$D3/             { add   bx,dx          (Y1-1) * 160 = row  }
  35.             $8B/$46/$0E/         { mov   ax,[bp+14]     X1                  }
  36.             $48/                 { dec   ax             X1 - 1              }
  37.             $D1/$E0/             { shl   ax,1           2 * (X1-1) = col    }
  38.             $01/$C3/             { add   bx,ax          bx = upper left     }
  39.             $8B/$F3/             { mov   si,bx          save for move later }
  40.             $1F/                 { pop   ds             DS:SI start addr    }
  41.             $1E/                 { push  ds             save for later move }
  42.             $8B/$5E/$04/         { mov   bx,[bp+04]     Y3                  }
  43.             $4B/                 { dec   bx             Y3 - 1              }
  44.             $8B/$D3/             { mov   dx,bx          save Y3 - 1         }
  45.             $B1/$07/             { mov   cl,7           shl coming          }
  46.             $D3/$E2/             { shl   dx,cl          (Y3-1) * 128        }
  47.             $B1/$05/             { mov   cl,5           setup shl           }
  48.             $D3/$E3/             { shl   bx,cl          (Y3-1) * 32         }
  49.             $01/$D3/             { add   bx,dx          (Y3-1) * 160 = row  }
  50.             $8B/$46/$06/         { mov   ax,[bp+06]     X3                  }
  51.             $48/                 { dec   ax             X3 - 1              }
  52.             $D1/$E0/             { shl   ax,1           2 * (X3-1) = col    }
  53.             $01/$C3/             { add   bx,ax          upper left of dest  }
  54.             $8B/$FB/             { mov   di,bx          setup for movsw     }
  55.             $07/                 { pop   es             ES:DI established   }
  56.             $8B/$46/$0C/         { mov   ax,[bp+12]     Y1                  }
  57.             $8B/$56/$08/         { mov   dx,[bp+08]     Y2                  }
  58.             $29/$C2/             { sub   dx,ax                              }
  59.             $42/                 { inc   dx             dx = num lines/move }
  60.             $8B/$46/$0E/         { mov   ax,[bp+14]     X1                  }
  61.             $8B/$4E/$0A/         { mov   cx,[bp+10]     X2                  }
  62.             $29/$C1/             { sub   cx,ax                              }
  63.             $41/                 { inc   cx             cx = num bytes/line }
  64.                          { MOVER:                                           }
  65.             $51/                 { push  cx             keep copy on hand   }
  66.             $FC/                 { cld                  forward move        }
  67.             $F3/$A5/     { rep     movsw                copy block          }
  68.             $59/                 { pop   cx             restore count       }
  69.             $4A/                 { dec   dx             1 less line to copy }
  70.             $74/$0F/             { jz    done           if zero, return     }
  71.             $8B/$D9/             { mov   bx,cx          find beginning . . .}
  72.             $D1/$E3/             { shl   bx,1           of next . . .       }
  73.             $B8/$A0/$00/         { mov   ax,160         line to move.       }
  74.             $29/$D8/             { sub   ax,bx          leave offset in ax  }
  75.             $01/$C6/             { add   si,ax          make SI point to it }
  76.             $01/$C7/             { add   di,ax          ditto for DI        }
  77.             $EB/$E9/             { jmp   mover          move next line      }
  78.                          { DONE:                                            }
  79.             $1F);                { pop   ds             restore DS          }
  80. end;